
export const localStorageKeys = {
  USER_INFO: 'HM_CONFIG_USER_INFO'
}

const CryptoJS = require('crypto-js')

export const setLocalStore = function (key, data) {
  const value = CryptoJS.AES.encrypt(JSON.stringify(data), 'dva-cryptojs-key')
  localStorage.setItem(key, value)
}
export const getLocalStore = function (key) {
  const data = localStorage.getItem(key)
  if (data) {
    const res = CryptoJS.AES.decrypt(data.toString(), 'dva-cryptojs-key')
    return JSON.parse(res.toString(CryptoJS.enc.Utf8))
  }
}
export const removeLocalStore = function (key) {
  localStorage.removeItem(key)
}
export const clearLocalStore = function (key) {
  localStorage.clear()
}
